can I use NSDictionary values as [@"[array abjectAtIndex:value]", key1,nil] ?
Posted
by srikanth rongali
on Stack Overflow
See other posts from Stack Overflow
or by srikanth rongali
Published on 2010-04-07T07:40:17Z
Indexed on
2010/04/07
7:43 UTC
Read the original article
Hit count: 203
I have a string of comma separated values in this way (0.2,0.3,0.4,1.0).
I used componentsSeperatedByString to store the values in an NSArray.
Now I need to store them in NSDictionary as
(1st value from NSArray), key1, (2nd Value of NsArray), key2,..nil];
My program is in this way
NSArray *split1;
NSDictionary *enemy1;
float value1;
for(id line in lines)
{
string1 = line;
split1 = [string1 componentsSeparatedByString:@","];
numberOfValues = [split1 count];
for(id value in split1)
{
enemy1 = [NSDictionary dictionaryWithObjectsAndKeys:@"[[split1 objectAtIndex:0]flaotValue]", @"A1", nil];
}
}
value1 = [enemy1 objectForKey:@"A1"];
Here lines is an NSArray consisting of CSV strings of number 10.
I am getting error as
error: incompatible types in assignment
Should I do not write my code in this way? Where I doing wrong ?
Please tell me my mistakes.
Thank You.
© Stack Overflow or respective owner